<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.w3.org/1999/xhtml">

<head>
    <th:block th:include="common/common_head :: commonHeader('收货')"/>
    <link rel="stylesheet" th:href="@{/static/js/plugins/jquery-layout/jquery.layout-latest.css}">
    <!-- <style type="text/css">.table {table-layout:fixed;}</style> -->
</head>

<body class="gray-bg">
<div class="container-div ui-layout-center">
    <div class="row">
        <div class="col-sm-3 search-condition">
            <label style="font-size: 35px;width: 60%">扫描二维码：</label>
        </div>

        <div class="col-sm-3 search-condition" style="height: 90%">
                <div class="select-list" style="height:80%">
                    <ul style="height:80%">
                        <li class="col-sm-3" style="width: 80%;height:80%">
                            <input id="receiptTotalCode" name="inquiryTotalCode" style="width: 90%;height: 31px" />
                        </li>
                        <li class="col-sm-3" style="width: 10%;height: 20%">
                            <button id="receipt" type="button" onclick="toreceiptsubmission()" class="btn btn-primary btn-rounded btn-sm"><i class="fa fa-search"></i>&nbsp;收货</button>
                        </li>
                    </ul>
                </div>
        </div>
    </div>
</div>
</body>
<!--引入公共js-->
<div th:include="common/onload_js :: onloadJS"></div>
<script type="text/javascript" th:src="@{/static/js/plugins/jquery-layout/jquery.layout-latest.js}"></script>
<script type="text/javascript">
    //获取光标并且触发ENTER自动收货;
    $("#receiptTotalCode").focus().keydown(function (){
        if(event.keyCode == 13){
            toreceiptsubmission();
        }
    }) ;
    //收货方法
    function toreceiptsubmission(){
        var QRcode = $("#receiptTotalCode").val().trim();
        if(QRcode!=null&&QRcode!=""){
            $.ajax({
                type: "POST",
                url: ctxPath + "/warehouseReceipt/receiptOperation",
                data: {"QRcode":QRcode},//抬头id
                dataType:"json",//必须
                cache: true,
                async: false,
                success: function (data) {
                    console.log(data);
                    if(data.result==0){
                        Dialog.msg("收货成功!");
                    }else if(data.result==1){
                        Dialog.alert("收货失败!");
                    }else{
                        Dialog.alert("收货失败,该发货单号已经收货,请检查单号!!!");
                    }
                }
            });
        }else{
            Dialog.alert("请先扫描二维码数据!!!");
        }

    }
</script>